package com.ieslab.powergrid.demosvr.controller;

import com.ieslab.powergrid.demosvr.entity.MyException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/** <p>Title: TestController2 </p>
 * <p>Description: 测试全局异常捕获功能</p>
 *
 * @author houpeibin
 * @date 2020-2-20 下午7:15:30
 * @version V1.0
 */
@RestController
public class TestController2 {
    @RequestMapping("testException")
    public String testException() throws Exception{
        throw new MissingServletRequestParameterException("name","String");
    }

    @RequestMapping("testMyException")
    public String testMyException() throws MyException {
        throw new MyException("i am a myException");
    }
}
